import Immutable from 'immutable';

import { ADD_<%= name.toUpperCase() %>_REDUX } from './actionTypes';
import preloadedState from '../../preloadedState';

const default<%= name.charAt(0).toUpperCase() + name.substr(1) %> = preloadedState.get('<%= name %>');

function reducer (state = default<%= name.charAt(0).toUpperCase() + name.substr(1) %>, action) {
    const { type, payload } = action;
    let newState;

    switch (type) {
        case ADD_<%= name.toUpperCase() %>_REDUX:
            return newState;
        default:
            return state;
    }
}

export default reducer;